using System.Linq;
using NUnit.Framework;

namespace Solver
{
	/// <summary>
	/// What is the first term in the Fibonacci sequence to contain 1000 digits?
	/// </summary>
	public class Problem025 : SelfChecker, IProblem
	{
		public int Id
		{
			get { return 25; }
		}

		public string Solve()
		{
			return Solve(1000).ToString();
		}

		[Test]
		public override void Check()
		{
			Assert.AreEqual(12, Solve(3));
			Assert.AreEqual(4782, Solve(1000));
		}

		private static int Solve(int param)
		{
			return new FibonacciNumbersSource(5 * param).Fibs().Count(f => f.ToString().Length < param);
		}
	}
}